package com.keeley.mybatisTools.ext;

import com.jfinal.config.*;
import com.jfinal.ext.handler.ContextPathHandler;
import com.keeley.mybatisTools.context.GrenertorContext;
import com.keeley.mybatisTools.controller.DataBaseController;
import org.beetl.ext.jfinal.BeetlRenderFactory;

/**
 * Created by djei on 2015-02-12.
 */
public class JfinalConfig extends JFinalConfig{
    @Override
    public void configConstant(Constants constants) {
        constants.setDevMode(true);
        constants.setMainRenderFactory(new BeetlRenderFactory());
        loadPropertyFile("conf.txt");
        GrenertorContext.FILE_DIR=getProperty("file_dir");
    }

    @Override
    public void configRoute(Routes routes) {
        routes.add("/", DataBaseController.class);

    }

    @Override
    public void configPlugin(Plugins plugins) {

    }

    @Override
    public void configInterceptor(Interceptors interceptors) {

    }

    @Override
    public void configHandler(Handlers handlers) {
        handlers.add(new ContextPathHandler("cxt"));
    }
}
